package com.xdtech.hotel.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.sql.Timestamp;

import com.xdtech.core.model.BaseItem;
import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.hotel.model.ProtocolCmd;

import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-05-25 21:41:22
 * @since 1.0
 * @see
 */
public class ProtocolCmdItem extends BaseItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="类型",width=100)
	private String type;
	@GridColumn(title="设备序列号",width=100)
	private String sn;
	@GridColumn(title="IP地址",width=100)
	private String ip;
	@GridColumn(title="设备端口",width=100)
	private String port;
	@GridColumn(title="指令",width=100)
	private String cmd;
	@GridColumn(title="第一次通信结果",width=100)
	private String firstResult;
	@GridColumn(title="第二次通信结果",width=100)
	private String secondResult;
	@GridColumn(title="通信结果",width=100)
	private String result;

	public void setId(Long id) {
		this.id = id;
		addQuerys("id", id);
	}
	public Long getId() {
		return id;
	}
	
	public void setType(String type) {
		this.type = type;
		addQuerys("type", type);
	}
	public String getType() {
		return type;
	}
	
	public void setSn(String sn) {
		this.sn = sn;
		addQuerys("sn", sn);
	}
	public String getSn() {
		return sn;
	}
	
	public void setIp(String ip) {
		this.ip = ip;
		addQuerys("ip", ip);
	}
	public String getIp() {
		return ip;
	}
	
	public void setPort(String port) {
		this.port = port;
		addQuerys("port", port);
	}
	public String getPort() {
		return port;
	}
	
	public void setCmd(String cmd) {
		this.cmd = cmd;
		addQuerys("cmd", cmd);
	}
	public String getCmd() {
		return cmd;
	}
	
	public void setFirstResult(String firstResult) {
		this.firstResult = firstResult;
		addQuerys("firstResult", firstResult);
	}
	public String getFirstResult() {
		return firstResult;
	}
	
	public void setSecondResult(String secondResult) {
		this.secondResult = secondResult;
		addQuerys("secondResult", secondResult);
	}
	public String getSecondResult() {
		return secondResult;
	}
	
	public void setResult(String result) {
		this.result = result;
		addQuerys("result", result);
	}
	public String getResult() {
		return result;
	}
	
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static ProtocolCmdItem createItem(ProtocolCmd protocolCmd) {
		ProtocolCmdItem protocolCmdItem = new ProtocolCmdItem();
		BeanUtils.copyProperties(protocolCmdItem, protocolCmd);
		//自定义属性设置填充
		return protocolCmdItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<ProtocolCmdItem> createItems(List<ProtocolCmd> protocolCmds) {
		List<ProtocolCmdItem> protocolCmdItems = new ArrayList<ProtocolCmdItem>();
		for (ProtocolCmd protocolCmd : protocolCmds) {
			protocolCmdItems.add(createItem(protocolCmd));
		}
		return protocolCmdItems;
	}
}
